/**
 * 编译打包构建项目
 */
import esbuild from "esbuild";
import BaseConfig from "./base.js";

(async () => {
  let result = await esbuild.build({
    ...BaseConfig,
    // 压缩代码
    minify: true,
    // 配合压缩移除空格
    minifyWhitespace: true,
    // 配合压缩重命名变量
    minifyIdentifiers: true,
    metafile: true,
    define: {
      __VUE_PROD_DEVTOOLS__: JSON.stringify(false),
    },
  });

  let text = await esbuild.analyzeMetafile(result.metafile, {
    verbose: true,
  });
  console.log(text);
})();
